home *** CD-ROM | disk | FTP | other *** search
- @echo off
- ! duplfile.bat Batch file to duplicate a file
- !
- ! duplfile name
- !
- ! where 'name' is the file to be duplicated. The name can be preceded by
- ! a path and a volume ID.
- !
- ! duplfile.bat calls uniqueName and extractPath
- !
- ! Copyright © 1994 by Rainbow Hill Pty Ltd. All rights reserved.
- !
-
- ! ensure that the first parameter is there and that the second one is not
- set doserr=13
- if not "%2 " == " " goto ERR_LBL
- if "%1 " == " " goto ERR_LBL
-
- ! ensure that the requested file is there
- set doserr=27
- if not exist "%1" goto ERR_LBL
-
- ! make the new name and check that it is valid
- call uniqueName "%1" duplfile_newName
- if not %doserr% == 0 goto ERR_LBL
-
- ! do the actual duplication
- call extractPath "%1" duplfile_path
- if not %doserr% == 0 goto ERR_LBL
- if "%duplfile_path%" == %%DUPLFILE_PATH%% goto WITHOUT_PATH_LBL
- incr duplfile_path by "%duplfile_newName%"
- goto DO_COPY_LBL
- :WITHOUT_PATH_LBL
- set duplfile_path=%duplfile_newName%
- :DO_COPY_LBL
- copy "%1" "%duplfile_path%"
- set doserr=0
- goto DONE_LBL
-
- :ERR_LBL
- show %doserr%
-
- :DONE_LBL
- ! remove the global variables
- set duplfile_newName=
- set duplfile_path=
-